Re: [SQL] nexval error duplicate key - Mailing list pgsql-general

From ron
Subject Re: [SQL] nexval error duplicate key
Date
Msg-id a05100307b893255947c3@[10.0.1.5]
Whole thread Raw
List pgsql-general
>Hi Ron,
>
>On Thu, 14 Feb 2002, ron wrote:
>
>>  I set up a table
>>
>>  field
>>    id
>>    name_insert
>>
>>  I used the code something like the following:
>>
>>  CREATE TABLE name_table (
>>           id   SERIAL,
>>           name_insert TEXT
>>       );
>>
>>
>>  When I use postgresql admin I get DATA 2
>>  the number is OUT of order
>
>Order doesn't matter.



**** some how it got deleted here ****

I would update one of the records in the middle so that the number
sheme would be like

1 john
2 mary
3 smith

then in the modification it would be (if I modified 2 mary)

1 john
3 smith
2 bertha

Then if I added a new record I would get a duplication error



>
>>  NOW when I add a new value
>>
>>  it give me an error that states:
>>
>>  --------------------------------------------------------
>>
>>  Error Occurred While Processing Request
>>
>>  Error Diagnostic Information
>>
>>  ODBC Error Code = 08S01 (Communication link failure)
>>
>>  Error while executing the query; ERROR: Cannot insert a duplicate key
>>  into unique index name_pkey
>>
>>  The error occurred while processing an element with a general
>>  identifier of (CFQUERY), occupying document position (1:61) to
>>  (1:110).
>>  --------------------------------------------------------
>
>What does your INSERT statement look like?  You'd want something like
>this ...
>
>INSERT INTO name_table (name_insert) VALUES ("Mary");
>
>This lets postgres deal with the id numbering itself.
>
>- James


Yip I use

<CFQUERY datasource="data_name"  NAME="field_name">

           INSERT INTO field_here

             (
                   field_go_here
                )

        VALUES

                (
                   'information'
                )

    </cfquery>

this is here  then when I update then insert that's when I get the error

Ron Sattar

--


        Sattar Group, Inc.    ICQ 153 46 249
        Voice 773 725 3445    Fax 773 442 0064
            http://www.SattarGroup.com

pgsql-general by date:

Previous
From: Jeff Davis
Date:
Subject: Re: Question: Who's Using Postgres
Next
From: Medi Montaseri
Date:
Subject: Re: Question: Who's Using Postgres